package com.zhanghe.wzq.handler;

import com.zhanghe.protocol.serializer.SerializerManager;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
import lombok.extern.slf4j.Slf4j;

/**
 * TextWebSocketFrameHandler
 *
 * @author Clevo
 * @date 2018/12/13
 */
@Slf4j
public class TextWebSocketFrameHandler extends SimpleChannelInboundHandler<TextWebSocketFrame> {

    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, TextWebSocketFrame textWebSocketFrame) throws Exception {
        String msg = textWebSocketFrame.text();
        log.debug("接收到客户端消息:[{}]",msg);
        channelHandlerContext.fireChannelRead(msg);
    }

}
